import flash.events.Event;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.geom.Matrix;
import flash.text.TextField;
import flash.text.TextFormat;

import CustomSprite;

import Images;

class GenericMenuEvent extends Event{
	public function new(customEventString:String){

	super(customEventString, true, false);

    }
}

class GenericMenu extends CustomSprite
{
private var BackButton:Sprite;
  public function new(inBackground:BitmapData,inWidth,inHeight)
  {
  super();
  this.graphics.beginBitmapFill(inBackground);
  this.graphics.drawRect(0, 0, inBackground.width, inBackground.height);
  resize(inWidth,inHeight);
  BackButton  = new CustomSprite();
  BackButton.graphics.beginFill(0xFFFFFF);
  BackButton.graphics.lineStyle(1);
  BackButton.graphics.drawRect(0,0,25,25);
  BackButton.graphics.beginBitmapFill(new XButton());
  BackButton.graphics.drawRect(0, 0, 25, 25);
  BackButton.graphics.endFill();
  BackButton.x=inWidth-35;
  BackButton.y = 10;
  BackButton.buttonMode = true;
  BackButton.addEventListener(MouseEvent.CLICK, onBackButtonClick);
  addChild(BackButton);

  }
private function onBackButtonClick(event:MouseEvent) {
    Back();
}
  public function Back()
  {
  dispatchEvent(new GenericMenuEvent("Back"));
  }



}